<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>YAMI4 - C++ general-purpose interface: yami::value_publisher Class Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>


</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">YAMI4 - C++ general-purpose interface
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('classyami_1_1value__publisher.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a>  </div>
  <div class="headertitle">
<div class="title">yami::value_publisher Class Reference</div>  </div>
</div>
<div class="contents">
<!-- doxytag: class="yami::value_publisher" -->
<p>Simple subscription publisher.  
 <a href="classyami_1_1value__publisher.html#details">More...</a></p>

<p><code>#include &lt;value_publisher.h&gt;</code></p>

<p><a href="classyami_1_1value__publisher-members.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classyami_1_1value__publisher.html#a29f4c86bd5128d1ed1906b5d6c2cce10">value_publisher</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructor.  <a href="#a29f4c86bd5128d1ed1906b5d6c2cce10"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classyami_1_1value__publisher.html#ad752f91110e9f32028ce6cc9933b65dd">~value_publisher</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Destructor.  <a href="#ad752f91110e9f32028ce6cc9933b65dd"></a><br/></td></tr>
<tr><td class="memTemplParams" colspan="2">template&lt;typename functor &gt; </td></tr>
<tr><td class="memTemplItemLeft" align="right" valign="top">&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classyami_1_1value__publisher.html#a8ebd2993b39e308566a4d0ce0ee23370">value_publisher</a> (functor &amp;f)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructor.  <a href="#a8ebd2993b39e308566a4d0ce0ee23370"></a><br/></td></tr>
<tr><td class="memTemplParams" colspan="2">template&lt;typename incoming_message_functor , typename queue_overflow_functor &gt; </td></tr>
<tr><td class="memTemplItemLeft" align="right" valign="top">&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classyami_1_1value__publisher.html#a1846bacc93402ec055da994017b769be">value_publisher</a> (incoming_message_functor &amp;f, std::size_t max_queue_length, queue_overflow_functor &amp;qof)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructor.  <a href="#a1846bacc93402ec055da994017b769be"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classyami_1_1value__publisher.html#a72cf3a934747c620866c9369063cad8a">register_at</a> (<a class="el" href="classyami_1_1agent.html">agent</a> &amp;controlling_agent, const std::string &amp;object_name)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Registers the publisher at the given agent.  <a href="#a72cf3a934747c620866c9369063cad8a"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac829af6c826db6d500a81fde444616cb"></a><!-- doxytag: member="yami::value_publisher::unregister" ref="ac829af6c826db6d500a81fde444616cb" args="()" -->
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classyami_1_1value__publisher.html#ac829af6c826db6d500a81fde444616cb">unregister</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Unregisters the publisher from its associated agent. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classyami_1_1value__publisher.html#a90f65454ddae823520e5d5f7a8fc1783">subscribe</a> (const std::string &amp;destination_target, const std::string &amp;destination_object)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Subscribes the new listener.  <a href="#a90f65454ddae823520e5d5f7a8fc1783"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classyami_1_1value__publisher.html#aa6e9681d98256f951c2edb87b0d99fe0">unsubscribe</a> (const std::string &amp;destination_target)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Unsubscribes the given listener.  <a href="#aa6e9681d98256f951c2edb87b0d99fe0"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classyami_1_1value__publisher.html#a3c33f8d1cdbd8f4154b86810df0a440a">publish</a> (const <a class="el" href="classyami_1_1serializable.html">serializable</a> &amp;value, std::size_t priority=0)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Publishes the new value.  <a href="#a3c33f8d1cdbd8f4154b86810df0a440a"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa27779f164d3dc2ff72a9ca542e8dd55"></a><!-- doxytag: member="yami::value_publisher::get_number_of_subscribers" ref="aa27779f164d3dc2ff72a9ca542e8dd55" args="() const " -->
std::size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classyami_1_1value__publisher.html#aa27779f164d3dc2ff72a9ca542e8dd55">get_number_of_subscribers</a> () const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the number of active subscribers. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">std::vector&lt; std::pair<br class="typebreak"/>
&lt; std::string, std::string &gt; &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classyami_1_1value__publisher.html#a3296d60ebbc31b2717c7bd4609453716">get_subscribers</a> () const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the information about all active subscribers.  <a href="#a3296d60ebbc31b2717c7bd4609453716"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>The subscription publisher that notifies remote listeners with published value updates.</p>
<p>Remote listeners can subscribe and unsubscribe at any time. </p>
</div><hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a29f4c86bd5128d1ed1906b5d6c2cce10"></a><!-- doxytag: member="yami::value_publisher::value_publisher" ref="a29f4c86bd5128d1ed1906b5d6c2cce10" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">value_publisher::value_publisher </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Creates the subscription publisher that is not registered at any agent. </p>

</div>
</div>
<a class="anchor" id="ad752f91110e9f32028ce6cc9933b65dd"></a><!-- doxytag: member="yami::value_publisher::~value_publisher" ref="ad752f91110e9f32028ce6cc9933b65dd" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">value_publisher::~value_publisher </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p><b>Note:</b> The destructor automatically unregisters the publisher from the agent it was registered at, which might cause hazards if some updates are pending in the incoming message queue. </p>

</div>
</div>
<a class="anchor" id="a8ebd2993b39e308566a4d0ce0ee23370"></a><!-- doxytag: member="yami::value_publisher::value_publisher" ref="a8ebd2993b39e308566a4d0ce0ee23370" args="(functor &amp;f)" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename functor &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">yami::value_publisher::value_publisher </td>
          <td>(</td>
          <td class="paramtype">functor &amp;&#160;</td>
          <td class="paramname"><em>f</em></td><td>)</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Creates the subscription publisher that is not registered at any agent and that has a handler for arbitrary remote commands.</p>
<p><b>Note:</b> The "subscribe" and "unsubscribe" messages are also forwarded to the user-provided callback, but these two messages are already "replied-to" by the publisher's implementation.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">f</td><td>The callable entity that can accept the <code><a class="el" href="classyami_1_1incoming__message.html" title="Incoming message.">incoming_message</a></code> as the invocation parameter. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a1846bacc93402ec055da994017b769be"></a><!-- doxytag: member="yami::value_publisher::value_publisher" ref="a1846bacc93402ec055da994017b769be" args="(incoming_message_functor &amp;f, std::size_t max_queue_length, queue_overflow_functor &amp;qof)" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename incoming_message_functor , typename queue_overflow_functor &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">yami::value_publisher::value_publisher </td>
          <td>(</td>
          <td class="paramtype">incoming_message_functor &amp;&#160;</td>
          <td class="paramname"><em>f</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::size_t&#160;</td>
          <td class="paramname"><em>max_queue_length</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">queue_overflow_functor &amp;&#160;</td>
          <td class="paramname"><em>qof</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Creates the subscription publisher that is not registered at any agent and that has a handler for arbitrary remote commands as well as for the queue overflow conditions.</p>
<p><b>Note:</b> The "subscribe" and "unsubscribe" messages are also forwarded to the user-provided callback, but these two messages are already processed by the publisher's implementation.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">f</td><td>The callable entity that can accept the <code><a class="el" href="classyami_1_1incoming__message.html" title="Incoming message.">incoming_message</a></code> as the invocation parameter. </td></tr>
    <tr><td class="paramname">max_queue_length</td><td>Length of message queue for each subscriber. </td></tr>
    <tr><td class="paramname">qof</td><td>The callable entity that can accept the <code>server_name</code>, <code>object_name</code> and <code>value</code> as invocation parameters. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a72cf3a934747c620866c9369063cad8a"></a><!-- doxytag: member="yami::value_publisher::register_at" ref="a72cf3a934747c620866c9369063cad8a" args="(agent &amp;controlling_agent, const std::string &amp;object_name)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void value_publisher::register_at </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classyami_1_1agent.html">agent</a> &amp;&#160;</td>
          <td class="paramname"><em>controlling_agent</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>object_name</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">controlling_agent</td><td>The agent which should manage the communication for this publisher. </td></tr>
    <tr><td class="paramname">object_name</td><td>The name of object that should be visible to remote subscribers. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a90f65454ddae823520e5d5f7a8fc1783"></a><!-- doxytag: member="yami::value_publisher::subscribe" ref="a90f65454ddae823520e5d5f7a8fc1783" args="(const std::string &amp;destination_target, const std::string &amp;destination_object)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void value_publisher::subscribe </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>destination_target</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>destination_object</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>This function is usually called internally as a result of processing the remote "subscribe" message, but can be also used locally if the listener's location is obtained via other means.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">destination_target</td><td>Target of the remote listener. </td></tr>
    <tr><td class="paramname">destination_object</td><td>Name of the remote listener's object. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="aa6e9681d98256f951c2edb87b0d99fe0"></a><!-- doxytag: member="yami::value_publisher::unsubscribe" ref="aa6e9681d98256f951c2edb87b0d99fe0" args="(const std::string &amp;destination_target)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void value_publisher::unsubscribe </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>destination_target</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">destination_target</td><td>Target of the remote listener. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a3c33f8d1cdbd8f4154b86810df0a440a"></a><!-- doxytag: member="yami::value_publisher::publish" ref="a3c33f8d1cdbd8f4154b86810df0a440a" args="(const serializable &amp;value, std::size_t priority=0)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void value_publisher::publish </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classyami_1_1serializable.html">serializable</a> &amp;&#160;</td>
          <td class="paramname"><em>value</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::size_t&#160;</td>
          <td class="paramname"><em>priority</em> = <code>0</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Sends the update message to all active listeners with the given value. In case of any errors or communication problems, the problematic listener is automatically unsubscribed.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">value</td><td>New value that is to be sent as update to all listeners. </td></tr>
    <tr><td class="paramname">priority</td><td>The priority of the update message. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a3296d60ebbc31b2717c7bd4609453716"></a><!-- doxytag: member="yami::value_publisher::get_subscribers" ref="a3296d60ebbc31b2717c7bd4609453716" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">std::vector&lt; std::pair&lt; std::string, std::string &gt; &gt; value_publisher::get_subscribers </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>The first component of each vector entry is a destination target and the second component is a destination object for the given subscriber. </p>

</div>
</div>
</div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="namespaceyami.html">yami</a>      </li>
      <li class="navelem"><a class="el" href="classyami_1_1value__publisher.html">value_publisher</a>      </li>

    <li class="footer">Generated on Tue Aug 6 2013 22:41:16 for YAMI4 - C++ general-purpose interface by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.5.1 </li>
   </ul>
 </div>


</body>
</html>
